package chat.server.user;

import java.net.Socket;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class UserManagementMap {

	private static final Map<String, String> usercreds = new HashMap<String,String>(); 
	private static final Map<String, Socket> userSocketMap = new HashMap<String,Socket>();
	static{
		usercreds.put("sivashankar", "JK");
		usercreds.put("sat", "srini");
	}

	public static boolean check(String uname, String pwd){
		String value = usercreds.get(uname);
		return pwd.equals(value);
	}
	public static synchronized void addUser(String username, Socket socket){
		userSocketMap.put(username, socket);
	}
	public static synchronized void removeUser(String username){
		userSocketMap.remove(username);
	}
	public static synchronized Socket getSocket(String username){
		return userSocketMap.get(username);
	}
	public static synchronized Set<String> getUserList(){
		return userSocketMap.keySet();
	}
	public static synchronized int size(){
		return userSocketMap.size();
	}
}
